package lily.phs.urh;

import lily.phs.object.HealthTest;
import lily.phs.object.HereTipa;
import lily.phs.urh.R;
import lily.ui.control.MyPopupWindow;


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;

/**
 * 健康体检表（Page 2）的界面布局和数据处理封装的view类
 * @author heckassitant
 *
 */
public class HealthTest_2 extends LinearLayout implements OnClickListener, OnFocusChangeListener{

//	private MyPopupWindow mPopupWindow;
	private Context mContext;
	private int profileid = 0;
	private int testid = 0;
	
	private EditText et_drink_per_day,et_abstinent_age,et_drink_startage,et_drink_sort_other,et_occupation,et_work_time,
	                 et_dust,et_dust_defence,et_radiation,et_radiation_defence,et_physics,et_physics_defence,et_chemistry,et_chemistry_defence,
	                 et_other_toxic,et_other_toxic_defence,et_eyesight_left,et_eyesight_right,et_correct_eyesight_left,et_correct_eyesight_right,
	                 et_eyeground_abnormal,et_skin_other,et_sclera_other,et_lymphnode_other,et_breathsound_abnormal,et_rale_other,
	                 et_heartrate,et_heart_murmurs;
	private RadioGroup rgDrinkFq,rgDrinkAbstinent,rgDrinkAlcoholism,rgOccupationHazards,rgDustDefence,rgRadiationDefence,
	                   rgPhysicsDefence,rgChemistryDefence,rgOtherToxicDefence,
	                   rgLip,rgTeeth,rgThroat,rgHearing,rgMotion,rgEyeground,rgSclera,rgLymphnode,rgBarrelChest,
	                   rgBreathSound,rgRale,rgHeartRhythm,rgHeartMurmurs;
	private RadioButton rb_drink_fq_1,rb_drink_fq_2,rb_drink_fq_3,rb_drink_fq_4,rb_abstinent_1,rb_abstinent_2,
	                    rb_drink_alcoholism_1,rb_drink_alcoholism_2,rb_occupation_hazards_1,rb_occupation_hazards_2,
	                    rb_dust_defence_1,rb_dust_defence_2,rb_radiation_defence_1,rb_radiation_defence_2,rb_physics_defence_1,rb_physics_defence_2,
	                    rb_chemistry_defence_1,rb_chemistry_defence_2,rb_other_toxic_defence_1,rb_other_toxic_defence_2,
	                    rb_lip_1,rb_lip_2,rb_lip_3,rb_lip_4,rb_lip_5,rb_teeth_1,rb_teeth_2,rb_teeth_3,rb_teeth_4,
	                    rb_throat_1,rb_throat_2,rb_throat_3,rb_hearing_1,rb_hearing_2,rb_motion_1,rb_motion_2,rb_eyeground_1,rb_eyeground_2,
	                    rb_skin_1,rb_skin_2,rb_skin_3,rb_skin_4,rb_skin_5,rb_skin_6,rb_skin_7,rb_sclera_1,rb_sclera_2,rb_sclera_3,rb_sclera_4,
	                    rb_lymphnode_1,rb_lymphnode_2,rb_lymphnode_3,rb_lymphnode_4,rb_barrelchest_1,rb_barrelchest_2,
	                    rb_breathsound_1,rb_breathsound_2,rb_rale_1,rb_rale_2,rb_rale_3,rb_rale_4,
	                    rb_heart_rhythm_1,rb_heart_rhythm_2,rb_heart_rhythm_3,rb_heart_murmurs_1,rb_heart_murmurs_2;
	
	private CheckBox cb_drink_sort_1,cb_drink_sort_2,cb_drink_sort_3,cb_drink_sort_4,cb_drink_sort_5;
	
	private HealthTest ht;
	private View child;
	
	
	public HealthTest_2(Context context,int profileId,int testId) {
		super(context);
		// TODO Auto-generated constructor stub
		//档案编号
		this.profileid = profileId;
		this.testid = testId;
		this.mContext = context;
		
		//将布局生成View
		final LayoutInflater inflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		child = inflater.inflate(R.layout.healthtest_2, null);
		
		
		//findViewsById();
		
		//initViews();
	}
	
	
	public int getProfileid() {
		return profileid;
	}


	public void setProfileid(int profileid) {
		this.profileid = profileid;
	}


	public int getTestid() {
		return testid;
	}


	public void setTestid(int testid) {
		this.testid = testid;
	}


	public void findViewsById() {
		// TODO Auto-generated method stub
		
		et_drink_per_day = (EditText)child.findViewById(R.id.ht2_lifestyle_drink_per_day);
		et_abstinent_age = (EditText)child.findViewById(R.id.ht2_lifestyle_drink_abstinent_age);
		et_abstinent_age.setOnFocusChangeListener(this);
		et_abstinent_age.setOnClickListener(this);
		et_drink_startage = (EditText)child.findViewById(R.id.ht2_lifestyle_drink_startage);
		et_drink_sort_other = (EditText)child.findViewById(R.id.ht2_lifestyle_drink_sort_other);
		et_drink_sort_other.setOnFocusChangeListener(this);
		et_drink_sort_other.setOnClickListener(this);
		et_occupation = (EditText)child.findViewById(R.id.ht2_lifestyle_occupation);
		et_work_time = (EditText)child.findViewById(R.id.ht2_lifestyle_work_time);
        et_dust = (EditText)child.findViewById(R.id.ht2_dust);
        et_dust_defence = (EditText)child.findViewById(R.id.ht2_dust_defence);
        et_dust_defence.setOnFocusChangeListener(this);
        et_dust_defence.setOnClickListener(this);
        et_radiation = (EditText)child.findViewById(R.id.ht2_radiation);
        et_radiation_defence = (EditText)child.findViewById(R.id.ht2_radiation_defence);
        et_radiation_defence.setOnFocusChangeListener(this);
        et_radiation_defence.setOnClickListener(this);
        et_physics = (EditText)child.findViewById(R.id.ht2_physics);
        et_physics_defence = (EditText)child.findViewById(R.id.ht2_physics_defence);
        et_physics_defence.setOnFocusChangeListener(this);
        et_physics_defence.setOnClickListener(this);
        et_chemistry = (EditText)child.findViewById(R.id.ht2_chemistry);
        et_chemistry_defence = (EditText)child.findViewById(R.id.ht2_chemistry_defence);
        et_chemistry_defence.setOnFocusChangeListener(this);
        et_chemistry_defence.setOnClickListener(this);
        et_other_toxic = (EditText)child.findViewById(R.id.ht2_othertoxic);
        et_other_toxic_defence = (EditText)child.findViewById(R.id.ht2_othertoxic_defence);
        et_other_toxic_defence.setOnFocusChangeListener(this);
        et_other_toxic_defence.setOnClickListener(this);
        et_eyesight_left = (EditText)child.findViewById(R.id.ht2_eyesight_left);
        et_eyesight_right = (EditText)child.findViewById(R.id.ht2_eyesight_right);
        et_correct_eyesight_left = (EditText)child.findViewById(R.id.ht2_correct_eyesight_left);
        et_correct_eyesight_right = (EditText)child.findViewById(R.id.ht2_correct_eyesight_right);
        et_eyeground_abnormal = (EditText)child.findViewById(R.id.ht2_eyeground_abnormal);
        et_eyeground_abnormal.setOnFocusChangeListener(this);
        et_eyeground_abnormal.setOnClickListener(this);
        et_skin_other = (EditText)child.findViewById(R.id.ht2_skin_other);
        et_skin_other.setOnFocusChangeListener(this);
        et_skin_other.setOnClickListener(this);
        et_sclera_other = (EditText)child.findViewById(R.id.ht2_sclera_other);
        et_sclera_other.setOnFocusChangeListener(this);
        et_sclera_other.setOnClickListener(this);
        et_lymphnode_other = (EditText)child.findViewById(R.id.ht2_lymphnode_other);
        et_lymphnode_other.setOnFocusChangeListener(this);
        et_lymphnode_other.setOnClickListener(this);
        et_breathsound_abnormal = (EditText)child.findViewById(R.id.ht2_breathsound_abnormal);
        et_breathsound_abnormal.setOnFocusChangeListener(this);
        et_breathsound_abnormal.setOnClickListener(this);
        et_rale_other = (EditText)child.findViewById(R.id.ht2_rale_other);
        et_rale_other.setOnFocusChangeListener(this);
        et_rale_other.setOnClickListener(this);
        et_heartrate = (EditText)child.findViewById(R.id.ht2_heartrate);
        et_heart_murmurs = (EditText)child.findViewById(R.id.ht2_heart_murmurs);
        et_heart_murmurs.setOnFocusChangeListener(this);
        et_heart_murmurs.setOnClickListener(this);
        rb_drink_fq_1 = (RadioButton)child.findViewById(R.id.ht2_lifestyle_drink_fq_1);
		rb_drink_fq_2 = (RadioButton)child.findViewById(R.id.ht2_lifestyle_drink_fq_2);
		rb_drink_fq_3 = (RadioButton)child.findViewById(R.id.ht2_lifestyle_drink_fq_3);
		rb_drink_fq_4 = (RadioButton)child.findViewById(R.id.ht2_lifestyle_drink_fq_4);
		rb_abstinent_1 = (RadioButton)child.findViewById(R.id.ht2_lifestyle_drink_abstinent_1);
		rb_abstinent_2 = (RadioButton)child.findViewById(R.id.ht2_lifestyle_drink_abstinent_2);
        rb_drink_alcoholism_1 = (RadioButton)child.findViewById(R.id.ht2_lifestyle_drink_alcoholism_1);
        rb_drink_alcoholism_2 = (RadioButton)child.findViewById(R.id.ht2_lifestyle_drink_alcoholism_2);
        rb_occupation_hazards_1 = (RadioButton)child.findViewById(R.id.ht2_lifestyle_occupation_hazards_1);
        rb_occupation_hazards_2 = (RadioButton)child.findViewById(R.id.ht2_lifestyle_occupation_hazards_2);
        rb_dust_defence_1 = (RadioButton)child.findViewById(R.id.ht2_dust_defence_1);
        rb_dust_defence_2 = (RadioButton)child.findViewById(R.id.ht2_dust_defence_2);
        rb_radiation_defence_1 = (RadioButton)child.findViewById(R.id.ht2_radiation_defence_1);
        rb_radiation_defence_2 = (RadioButton)child.findViewById(R.id.ht2_radiation_defence_2);
        rb_physics_defence_1 = (RadioButton)child.findViewById(R.id.ht2_physics_defence_1);
        rb_physics_defence_2 = (RadioButton)child.findViewById(R.id.ht2_physics_defence_2);
        rb_chemistry_defence_1 = (RadioButton)child.findViewById(R.id.ht2_chemistry_defence_1);
        rb_chemistry_defence_2 = (RadioButton)child.findViewById(R.id.ht2_chemistry_defence_2);
        rb_other_toxic_defence_1 = (RadioButton)child.findViewById(R.id.ht2_othertoxic_defence_1);
        rb_other_toxic_defence_2 = (RadioButton)child.findViewById(R.id.ht2_othertoxic_defence_2);
        rb_lip_1 = (RadioButton)child.findViewById(R.id.ht2_lip_1);
        rb_lip_2 = (RadioButton)child.findViewById(R.id.ht2_lip_2);
        rb_lip_3 = (RadioButton)child.findViewById(R.id.ht2_lip_3);
        rb_lip_4 = (RadioButton)child.findViewById(R.id.ht2_lip_4);
        rb_lip_5 = (RadioButton)child.findViewById(R.id.ht2_lip_5);
        rb_teeth_1 = (RadioButton)child.findViewById(R.id.ht2_teeth_1);
        rb_teeth_2 = (RadioButton)child.findViewById(R.id.ht2_teeth_2);
        rb_teeth_3 = (RadioButton)child.findViewById(R.id.ht2_teeth_3);
        rb_teeth_4 = (RadioButton)child.findViewById(R.id.ht2_teeth_4);
        rb_throat_1 = (RadioButton)child.findViewById(R.id.ht2_throat_1);
        rb_throat_2 = (RadioButton)child.findViewById(R.id.ht2_throat_2);
        rb_throat_3 = (RadioButton)child.findViewById(R.id.ht2_throat_3);
        rb_hearing_1 = (RadioButton)child.findViewById(R.id.ht2_hearing_1);
        rb_hearing_2 = (RadioButton)child.findViewById(R.id.ht2_hearing_2);
        rb_motion_1 = (RadioButton)child.findViewById(R.id.ht2_motion_1);
        rb_motion_2 = (RadioButton)child.findViewById(R.id.ht2_motion_2);
        rb_eyeground_1 = (RadioButton)child.findViewById(R.id.ht2_eyeground_1);
        rb_eyeground_2 = (RadioButton)child.findViewById(R.id.ht2_eyeground_2);
        rb_skin_1 = (RadioButton)child.findViewById(R.id.ht2_skin_1);
        rb_skin_1.setOnClickListener(this);
        rb_skin_2 = (RadioButton)child.findViewById(R.id.ht2_skin_2);
        rb_skin_2.setOnClickListener(this);
        rb_skin_3 = (RadioButton)child.findViewById(R.id.ht2_skin_3);
        rb_skin_3.setOnClickListener(this);
        rb_skin_4 = (RadioButton)child.findViewById(R.id.ht2_skin_4);
        rb_skin_4.setOnClickListener(this);
        rb_skin_5 = (RadioButton)child.findViewById(R.id.ht2_skin_5);
        rb_skin_5.setOnClickListener(this);
        rb_skin_6 = (RadioButton)child.findViewById(R.id.ht2_skin_6);
        rb_skin_6.setOnClickListener(this);
        rb_skin_7 = (RadioButton)child.findViewById(R.id.ht2_skin_7);
        rb_skin_7.setOnClickListener(this);
        rb_sclera_1 = (RadioButton)child.findViewById(R.id.ht2_sclera_1);
        rb_sclera_2 = (RadioButton)child.findViewById(R.id.ht2_sclera_2);
        rb_sclera_3 = (RadioButton)child.findViewById(R.id.ht2_sclera_3);
        rb_sclera_4 = (RadioButton)child.findViewById(R.id.ht2_sclera_4);
        rb_lymphnode_1 = (RadioButton)child.findViewById(R.id.ht2_lymphnode_1);
        rb_lymphnode_2 = (RadioButton)child.findViewById(R.id.ht2_lymphnode_2);
        rb_lymphnode_3 = (RadioButton)child.findViewById(R.id.ht2_lymphnode_3);
        rb_lymphnode_4 = (RadioButton)child.findViewById(R.id.ht2_lymphnode_4);
        rb_barrelchest_1 = (RadioButton)child.findViewById(R.id.ht2_barrelchest_1);
        rb_barrelchest_2 = (RadioButton)child.findViewById(R.id.ht2_barrelchest_2);
        rb_breathsound_1 = (RadioButton)child.findViewById(R.id.ht2_breathsound_1);
        rb_breathsound_2 = (RadioButton)child.findViewById(R.id.ht2_breathsound_2);
        rb_rale_1 = (RadioButton)child.findViewById(R.id.ht2_rale_1);
        rb_rale_2 = (RadioButton)child.findViewById(R.id.ht2_rale_2);
        rb_rale_3 = (RadioButton)child.findViewById(R.id.ht2_rale_3);
        rb_rale_4 = (RadioButton)child.findViewById(R.id.ht2_rale_4);
        rb_heart_rhythm_1 = (RadioButton)child.findViewById(R.id.ht2_heart_rhythm_1);
        rb_heart_rhythm_2 = (RadioButton)child.findViewById(R.id.ht2_heart_rhythm_2);
        rb_heart_rhythm_3 = (RadioButton)child.findViewById(R.id.ht2_heart_rhythm_3);
        rb_heart_murmurs_1 = (RadioButton)child.findViewById(R.id.ht2_heart_murmurs_1);
        rb_heart_murmurs_2 = (RadioButton)child.findViewById(R.id.ht2_heart_murmurs_2);
		cb_drink_sort_1 = (CheckBox)child.findViewById(R.id.ht2_lifestyle_drink_sort_1);
		cb_drink_sort_2 = (CheckBox)child.findViewById(R.id.ht2_lifestyle_drink_sort_2);
		cb_drink_sort_3 = (CheckBox)child.findViewById(R.id.ht2_lifestyle_drink_sort_3);
		cb_drink_sort_4 = (CheckBox)child.findViewById(R.id.ht2_lifestyle_drink_sort_4);
		cb_drink_sort_5 = (CheckBox)child.findViewById(R.id.ht2_lifestyle_drink_sort_5);
		rgDrinkFq = (RadioGroup)child.findViewById(R.id.drinkfq);
		rgDrinkAbstinent = (RadioGroup)child.findViewById(R.id.drink_abstinent);
		rgDrinkAlcoholism = (RadioGroup)child.findViewById(R.id.drink_alcoholism);
		rgOccupationHazards = (RadioGroup)child.findViewById(R.id.occupation_hazards);
		rgDustDefence = (RadioGroup)child.findViewById(R.id.dust_defence);
		rgRadiationDefence = (RadioGroup)child.findViewById(R.id.radiation_defence);
        rgPhysicsDefence = (RadioGroup)child.findViewById(R.id.physics_defence);
        rgChemistryDefence = (RadioGroup)child.findViewById(R.id.chemistry_defence);
        rgOtherToxicDefence = (RadioGroup)child.findViewById(R.id.othertoxic_defence);
        rgLip = (RadioGroup)child.findViewById(R.id.lips);
        rgTeeth = (RadioGroup)child.findViewById(R.id.teeth);
        rgThroat = (RadioGroup)child.findViewById(R.id.throat);
        rgHearing = (RadioGroup)child.findViewById(R.id.hearing);
        rgMotion = (RadioGroup)child.findViewById(R.id.motion);
        rgEyeground = (RadioGroup)child.findViewById(R.id.eyeground);
        rgSclera = (RadioGroup)child.findViewById(R.id.sclera);
        rgLymphnode = (RadioGroup)child.findViewById(R.id.lymphnode);
        rgBarrelChest = (RadioGroup)child.findViewById(R.id.barrelchest);
        rgBreathSound = (RadioGroup)child.findViewById(R.id.breathsound);
        rgRale = (RadioGroup)child.findViewById(R.id.rale);
        rgHeartRhythm = (RadioGroup)child.findViewById(R.id.heart_rhythm);
        rgHeartMurmurs = (RadioGroup)child.findViewById(R.id.heart_murmurs);
	}
	
	/**
	 * 根据ID从数据库中读出数据并填充views
	 */
	public void initViews() {
		// TODO Auto-generated method stub
		
		initialState();
		
		String temp = "";
		int itemp = -1;
		float ftemp = -1f;
		
		itemp = ht.getHete_drink_fq();
		switch(itemp){
		case 1:
			rgDrinkFq.check(0);
			rb_drink_fq_1.setChecked(true);
			break;
		case 2:
			rgDrinkFq.check(1);
			rb_drink_fq_2.setChecked(true);
			break;
		case 3:
			rgDrinkFq.check(2);
			rb_drink_fq_3.setChecked(true);
			break;
		case 4:
			rgDrinkFq.check(3);
			rb_drink_fq_4.setChecked(true);
			break;
		}
		
		ftemp = ht.getHete_drink_per_day();
		if(ftemp!=-1f){
			et_drink_per_day.setText(String.valueOf(ftemp));
		}
		
		itemp = ht.getHete_is_abstinent();
		switch(itemp){
		case 1:
			rgDrinkAbstinent.check(0);
			rb_abstinent_1.setChecked(true);
			break;
		case 2:
			rgDrinkAbstinent.check(1);
			rb_abstinent_2.setChecked(true);
			break;
		}
		
		itemp = ht.getHete_abstent_age();
		if(itemp!=-1){
			et_abstinent_age.setText(String.valueOf(itemp));
		}
		itemp = ht.getHete_drink_startage();
		if(itemp!=-1){
			et_drink_startage.setText(String.valueOf(itemp));
		}
		itemp = ht.getHete_recent_alcoholism();
		switch(itemp){
		case 1:
			rgDrinkAlcoholism.check(0);
			rb_drink_alcoholism_1.setChecked(true);
			break;
		case 2:
			rgDrinkAlcoholism.check(1);
			rb_drink_alcoholism_2.setChecked(true);
			break;
		}
		
		temp = ht.getHete_drink_sorts();
		if(temp.length()>0){
			String[] ss = temp.split(",");
			for(int i=0;i<ss.length;i++){
				int k = Integer.parseInt(ss[i]);
				switch(k){
				case 1:
					cb_drink_sort_1.setChecked(true);
					break;
				case 2:
					cb_drink_sort_2.setChecked(true);
					break;
				case 3:
					cb_drink_sort_3.setChecked(true);
					break;
				case 4:
					cb_drink_sort_4.setChecked(true);
					break;
				case 5:{
					cb_drink_sort_5.setChecked(true);
					temp = ht.getHete_drink_other_sort();
					et_drink_sort_other.setText(temp);
					break;
				}
				}
			}
		}
		
		itemp = ht.getHete_has_occupational_hazards();
		switch(itemp){
		case 1:
			rgOccupationHazards.check(0);
			rb_occupation_hazards_1.setChecked(true);
			break;
		case 2:
			rgOccupationHazards.check(1);
			rb_occupation_hazards_2.setChecked(true);
			break;
		}
		
		temp = ht.getHete_occupation();
		et_occupation.setText(temp);
		itemp = ht.getHete_work_time();
		if(itemp!=-1){
			et_work_time.setText(String.valueOf(itemp));
		}
		
		temp = ht.getHete_dust();
		et_dust.setText(temp);
		itemp = ht.getHete_dust_has_defence();
		switch(itemp){
		case 1:
			rgDustDefence.check(0);
			rb_dust_defence_1.setChecked(true);
			break;
		case 2:
			rgDustDefence.check(1);
			rb_dust_defence_2.setChecked(true);
			temp = ht.getHete_dust_defence();
			et_dust_defence.setText(temp);
			break;
		}
		temp = ht.getHete_radiation();
		et_radiation.setText(temp);
		itemp = ht.getHete_radiation_has_defence();
		switch(itemp){
		case 1:
			rgRadiationDefence.check(0);
			rb_radiation_defence_1.setChecked(true);
			break;
		case 2:
			rgRadiationDefence.check(1);
			rb_radiation_defence_2.setChecked(true);
			temp = ht.getHete_radiaiton_defence();
			et_radiation_defence.setText(temp);
			break;
		}
		temp = ht.getHete_physics();
		et_physics.setText(temp);
		itemp = ht.getHete_physics_has_defence();
		switch(itemp){
		case 1:
			rgPhysicsDefence.check(0);
			rb_physics_defence_1.setChecked(true);
			break;
		case 2:
			rgPhysicsDefence.check(1);
			rb_physics_defence_2.setChecked(true);
			temp = ht.getHete_physics_defence();
			et_physics_defence.setText(temp);
			break;
		}
		temp = ht.getHete_chemistry();
		et_chemistry.setText(temp);
		itemp = ht.getHete_chemistry_has_defence();
		switch(itemp){
		case 1:
			rgChemistryDefence.check(0);
			rb_chemistry_defence_1.setChecked(true);
			break;
		case 2:
			rgChemistryDefence.check(1);
			rb_chemistry_defence_2.setChecked(true);
			temp = ht.getHete_chemistry_defence();
			et_chemistry_defence.setText(temp);
			break;
		}
		temp = ht.getHete_other_toxic();
		et_other_toxic.setText(temp);
		itemp = ht.getHete_other_toxic_has_defence();
		switch(itemp){
		case 1:
			rgOtherToxicDefence.check(0);
			rb_other_toxic_defence_1.setChecked(true);
			break;
		case 2:
			rgOtherToxicDefence.check(1);
			rb_other_toxic_defence_2.setChecked(true);
			temp = ht.getHete_other_toxic_defence();
			et_other_toxic_defence.setText(temp);
			break;
		}
		
		itemp = ht.getHete_lips();
		switch(itemp){
		case 1:
			rgLip.check(0);
			rb_lip_1.setChecked(true);
			break;
		case 2:
			rgLip.check(1);
			rb_lip_2.setChecked(true);
			break;
		case 3:
			rgLip.check(2);
			rb_lip_3.setChecked(true);
			break;
		case 4:
			rgLip.check(3);
			rb_lip_4.setChecked(true);
			break;
		case 5:
			rgLip.check(4);
			rb_lip_5.setChecked(true);
			break;
		}
		
		itemp = ht.getHete_teeth();
		switch(itemp){
		case 1:
			rgTeeth.check(0);
			rb_teeth_1.setChecked(true);
			break;
		case 2:
			rgTeeth.check(1);
			rb_teeth_2.setChecked(true);
			break;
		case 3:
			rgTeeth.check(2);
			rb_teeth_3.setChecked(true);
			break;
		case 4:
			rgTeeth.check(3);
			rb_teeth_4.setChecked(true);
			break;
		}
		
		itemp = ht.getHete_throat();
		switch(itemp){
		case 1:
			rgThroat.check(0);
			rb_throat_1.setChecked(true);
			break;
		case 2:
			rgThroat.check(1);
			rb_throat_2.setChecked(true);
			break;
		case 3:
			rgThroat.check(2);
			rb_throat_3.setChecked(true);
			break;
		}
		
		ftemp = ht.getHete_eyesight_left();
		if(ftemp!=-1f){
			et_eyesight_left.setText(String.valueOf(ftemp));
		}
		ftemp = ht.getHete_eyesight_right();
		if(ftemp!=-1f){
			et_eyesight_right.setText(String.valueOf(ftemp));
		}
		ftemp = ht.getHete_correct_eyesight_left();
		if(ftemp!=-1f){
			et_correct_eyesight_left.setText(String.valueOf(ftemp));
		}
		ftemp = ht.getHete_correct_eyesight_right();
		if(ftemp!=-1f){
			et_correct_eyesight_right.setText(String.valueOf(ftemp));
		}
		
		itemp = ht.getHete_hearing();
		switch(itemp){
		case 1:
			rgHearing.check(0);
			rb_hearing_1.setChecked(true);
			break;
		case 2:
			rgHearing.check(1);
			rb_hearing_2.setChecked(true);
			break;
		}
		
		itemp = ht.getHete_motion_funtion();
		switch(itemp){
		case 1:
			rgMotion.check(0);
			rb_motion_1.setChecked(true);
			break;
		case 2:
			rgMotion.check(1);
			rb_motion_2.setChecked(true);
			break;
		}
		
		itemp = ht.getHete_eyeground_isnormal();
		switch(itemp){
		case 1:
			rgEyeground.check(0);
			rb_eyeground_1.setChecked(true);
			break;
		case 2:{
			rgEyeground.check(1);
			rb_eyeground_2.setChecked(true);
			temp = ht.getHete_eyeground_abnormal();
			et_eyeground_abnormal.setText(temp);
			break;
		}
		}
		
		itemp = ht.getHete_skin();
		switch(itemp){
		case 1:
			rb_skin_1.setChecked(true);
			break;
		case 2:
			rb_skin_2.setChecked(true);
			break;
		case 3:
			rb_skin_3.setChecked(true);
			break;
		case 4:
			rb_skin_4.setChecked(true);
			break;
		case 5:
			rb_skin_5.setChecked(true);
			break;
		case 6:
			rb_skin_6.setChecked(true);
			break;
		case 7:{
			rb_skin_7.setChecked(true);
			temp = ht.getHete_skin_other();
			et_skin_other.setText(temp);
			break;
		}
		}
		
		itemp = ht.getHete_sclera();
		switch(itemp){
		case 1:
			rgSclera.check(0);
			rb_sclera_1.setChecked(true);
			break;
		case 2:
			rgSclera.check(1);
			rb_sclera_2.setChecked(true);
			break;
		case 3:
			rgSclera.check(2);
			rb_sclera_3.setChecked(true);
			break;
		case 4:{
			rgSclera.check(3);
			rb_sclera_4.setChecked(true);
			temp = ht.getHete_sclera_other();
			et_sclera_other.setText(temp);
			break;
		}
		}
		
		itemp = ht.getHete_lymphnode();
		switch(itemp){
		case 1:
			rgLymphnode.check(0);
			rb_lymphnode_1.setChecked(true);
			break;
		case 2:
			rgLymphnode.check(1);
			rb_lymphnode_2.setChecked(true);
			break;
		case 3:
			rgLymphnode.check(2);
			rb_lymphnode_3.setChecked(true);
			break;
		case 4:{
			rgLymphnode.check(3);
			rb_lymphnode_4.setChecked(true);
			temp = ht.getHete_lymphnode_other();
			et_lymphnode_other.setText(temp);
			break;
		}
		}
		
		itemp = ht.getHete_barrelchest();
		switch(itemp){
		case 1:
			rgBarrelChest.check(0);
			rb_barrelchest_1.setChecked(true);
			break;
		case 2:
			rgBarrelChest.check(1);
			rb_barrelchest_2.setChecked(true);
			break;
		}
		
		itemp = ht.getHete_breathsound_isnormal();
		switch(itemp){
		case 1:
			rgBreathSound.check(0);
			rb_breathsound_1.setChecked(true);
			break;
		case 2:{
			rgBreathSound.check(1);
			rb_breathsound_2.setChecked(true);
			temp = ht.getHete_breathsound_abnormal();
			et_breathsound_abnormal.setText(temp);
			break;
		}
		}
		
		itemp = ht.getHete_rale();
		switch(itemp){
		case 1:
			rgRale.check(0);
			rb_rale_1.setChecked(true);
			break;
		case 2:
			rgRale.check(1);
			rb_rale_2.setChecked(true);
			break;
		case 3:
			rgRale.check(2);
			rb_rale_3.setChecked(true);
			break;
		case 4:{
			rgRale.check(3);
			rb_rale_4.setChecked(true);
			temp = ht.getHete_rale_other();
			et_rale_other.setText(temp);
			break;
		}
		}
		
		itemp = ht.getHete_heartrate();
		if(itemp!=-1){
			et_heartrate.setText(String.valueOf(itemp));
		}
		
		itemp = ht.getHete_heart_rhythm();
		switch(itemp){
		case 1:
			rgHeartRhythm.check(0);
			rb_heart_rhythm_1.setChecked(true);
			break;
		case 2:
			rgHeartRhythm.check(1);
			rb_heart_rhythm_2.setChecked(true);
			break;
		case 3:
			rgHeartRhythm.check(2);
			rb_heart_rhythm_3.setChecked(true);
			break;
		}
		
		itemp = ht.getHete_has_heart_murmurs();
		switch(itemp){
		case 1:
			rgHeartMurmurs.check(0);
			rb_heart_murmurs_1.setChecked(true);
			break;
		case 2:{
			rgHeartMurmurs.check(1);
			rb_heart_murmurs_2.setChecked(true);
			temp = ht.getHete_heart_murmurs();
			et_heart_murmurs.setText(temp);
			break;
		}
		}
		
		
	}
	/**
	 * 初始时未空表：横线为空，所有选择项未选中
	 */
	private void initialState() {
		// TODO Auto-generated method stub
		et_drink_per_day.setText("");
		et_abstinent_age.setText("");
		et_drink_startage.setText("");
		et_drink_sort_other.setText("");
		et_occupation.setText("");
		et_work_time.setText("");
        et_dust.setText("");
        et_dust_defence.setText("");
        et_radiation.setText("");
        et_radiation_defence.setText("");
        et_physics.setText("");
        et_physics_defence.setText("");
        et_chemistry.setText("");
        et_chemistry_defence.setText("");
        et_other_toxic.setText("");
        et_other_toxic_defence.setText("");
        et_eyesight_left.setText("");
        et_eyesight_right.setText("");
        et_correct_eyesight_left.setText("");
        et_correct_eyesight_right.setText("");
        et_eyeground_abnormal.setText("");
        et_skin_other.setText("");
        et_sclera_other.setText("");
        et_lymphnode_other.setText("");
        et_breathsound_abnormal.setText("");
        et_rale_other.setText("");
        et_heartrate.setText("");
        et_heart_murmurs.setText("");
		rb_drink_fq_1.setChecked(false);
		rb_drink_fq_2.setChecked(false);
		rb_drink_fq_3.setChecked(false);
		rb_drink_fq_4.setChecked(false);
		rb_abstinent_1.setChecked(false);
		rb_abstinent_2.setChecked(false);
        rb_drink_alcoholism_1.setChecked(false);
        rb_drink_alcoholism_2.setChecked(false);
        rb_occupation_hazards_1.setChecked(false);
        rb_occupation_hazards_2.setChecked(false);
        rb_dust_defence_1.setChecked(false);
        rb_dust_defence_2.setChecked(false);
        rb_radiation_defence_1.setChecked(false);
        rb_radiation_defence_2.setChecked(false);
        rb_physics_defence_1.setChecked(false);
        rb_physics_defence_2.setChecked(false);
        rb_chemistry_defence_1.setChecked(false);
        rb_chemistry_defence_2.setChecked(false);
        rb_other_toxic_defence_1.setChecked(false);
        rb_other_toxic_defence_2.setChecked(false);
        rb_lip_1.setChecked(false);
        rb_lip_2.setChecked(false);
        rb_lip_3.setChecked(false);
        rb_lip_4.setChecked(false);
        rb_lip_5.setChecked(false);
        rb_teeth_1.setChecked(false);
        rb_teeth_2.setChecked(false);
        rb_teeth_3.setChecked(false);
        rb_teeth_4.setChecked(false);
        rb_throat_1.setChecked(false);
        rb_throat_2.setChecked(false);
        rb_throat_3.setChecked(false);
        rb_hearing_1.setChecked(false);
        rb_hearing_2.setChecked(false);
        rb_motion_1.setChecked(false);
        rb_motion_2.setChecked(false);
        rb_eyeground_1.setChecked(false);
        rb_eyeground_2.setChecked(false);
        rb_skin_1.setChecked(false);
        rb_skin_2.setChecked(false);
        rb_skin_3.setChecked(false);
        rb_skin_4.setChecked(false);
        rb_skin_5.setChecked(false);
        rb_skin_6.setChecked(false);
        rb_skin_7.setChecked(false);
        rb_sclera_1.setChecked(false);
        rb_sclera_2.setChecked(false);
        rb_sclera_3.setChecked(false);
        rb_sclera_4.setChecked(false);
        rb_lymphnode_1.setChecked(false);
        rb_lymphnode_2.setChecked(false);
        rb_lymphnode_3.setChecked(false);
        rb_lymphnode_4.setChecked(false);
        rb_barrelchest_1.setChecked(false);
        rb_barrelchest_2.setChecked(false);
        rb_breathsound_1.setChecked(false);
        rb_breathsound_2.setChecked(false);
        rb_rale_1.setChecked(false);
        rb_rale_2.setChecked(false);
        rb_rale_3.setChecked(false);
        rb_rale_4.setChecked(false);
        rb_heart_rhythm_1.setChecked(false);
        rb_heart_rhythm_2.setChecked(false);
        rb_heart_rhythm_3.setChecked(false);
        rb_heart_murmurs_1.setChecked(false);
        rb_heart_murmurs_2.setChecked(false);
		cb_drink_sort_1.setChecked(false);
		cb_drink_sort_2.setChecked(false);
		cb_drink_sort_3.setChecked(false);
		cb_drink_sort_4.setChecked(false);
		cb_drink_sort_5.setChecked(false);
	}


	/**
	 * 添加view到contentview
	 */
	public void setMyView(){
		this.removeAllViews();
		LayoutParams lp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
		this.addView(child,lp);
	}
	
	/**
	 * 将整个界面作为一个view对象
	 * @return 整个界面view
	 */
	public View getMyView(){
		return this.child;
	}
	
	/**
	 * 检出数据
	 */
	public void fetchData(){
		ht = new HealthTest(mContext);
		ht.selectHealthTest(this.profileid,this.testid);
		
	}
	
	
	/**
	 * 读取views的值并保存至ID对应的记录中
	 */
	public void saveViews() {
		HealthTest ht = new HealthTest(mContext);
		ht.selectHealthTest(profileid, testid);
		String temp = "";
		StringBuffer sb = new StringBuffer();
//		int itemp = -1;
//		float ftemp = -1.0f;
		
		if(rb_drink_fq_1.isChecked()==true){
			ht.setHete_drink_fq(1);
		}else if(rb_drink_fq_2.isChecked()==true){
			ht.setHete_drink_fq(2);
		}else if(rb_drink_fq_3.isChecked()==true){
			ht.setHete_drink_fq(3);
		}else if(rb_drink_fq_4.isChecked()==true){
			ht.setHete_drink_fq(4);
		}
		
		temp = et_drink_per_day.getText().toString();
		if(temp.length()>0){
			ht.setHete_drink_per_day(Float.parseFloat(temp));
		}
		
		if(rb_abstinent_1.isChecked()==true){
			ht.setHete_is_abstinent(1);
		}else if(rb_abstinent_2.isChecked()==true){
			ht.setHete_is_abstinent(2);
			temp = et_abstinent_age.getText().toString();
			if(temp.length()>0){
				ht.setHete_abstent_age(Integer.parseInt(temp));
			}
		}
		
		temp = et_drink_startage.getText().toString();
		if(temp.length()>0){
			ht.setHete_drink_startage(Integer.parseInt(temp));
		}
		
		if(rb_drink_alcoholism_1.isChecked()==true){
			ht.setHete_recent_alcoholism(1);
		}else if(rb_drink_alcoholism_2.isChecked()==true){
			ht.setHete_recent_alcoholism(2);
		}
		
		sb = new StringBuffer();
		if(cb_drink_sort_1.isChecked()==true){
			sb.append("1,");
		}
		if(cb_drink_sort_2.isChecked()==true){
			sb.append("2,");
		}
		if(cb_drink_sort_3.isChecked()==true){
			sb.append("3,");
		}
		if(cb_drink_sort_4.isChecked()==true){
			sb.append("4,");
		}
		if(cb_drink_sort_5.isChecked()==true){
			sb.append("5,");
			temp = et_drink_sort_other.getText().toString();
			ht.setHete_drink_other_sort(temp);
		}
		ht.setHete_drink_sorts(sb.toString());
		
		if(rb_occupation_hazards_1.isChecked()==true){
			ht.setHete_has_occupational_hazards(1);
		}else if(rb_occupation_hazards_2.isChecked()==true){
			ht.setHete_has_occupational_hazards(2);
		}
		
		temp = et_occupation.getText().toString();
		ht.setHete_occupation(temp);
		
		temp = et_work_time.getText().toString();
		if(temp.length()>0){
			ht.setHete_work_time(Integer.parseInt(temp));
		}
		
		temp = et_dust.getText().toString();
		ht.setHete_dust(temp);
		if(rb_dust_defence_1.isChecked()==true){
			ht.setHete_dust_has_defence(1);
		}else if(rb_dust_defence_2.isChecked()==true){
			ht.setHete_dust_has_defence(2);
			temp = et_dust_defence.getText().toString();
			ht.setHete_dust_defence(temp);
		}
		
		temp = et_radiation.getText().toString();
		ht.setHete_radiation(temp);
		if(rb_radiation_defence_1.isChecked()==true){
			ht.setHete_radiation_has_defence(1);
		}else if(rb_radiation_defence_2.isChecked()==true){
			ht.setHete_radiation_has_defence(2);
			temp = et_radiation_defence.getText().toString();
			ht.setHete_radiaiton_defence(temp);
		}
		temp = et_physics.getText().toString();
		ht.setHete_physics(temp);
		if(rb_physics_defence_1.isChecked()==true){
			ht.setHete_physics_has_defence(1);
		}else if(rb_physics_defence_2.isChecked()==true){
			ht.setHete_physics_has_defence(2);
			temp = et_physics_defence.getText().toString();
			ht.setHete_physics_defence(temp);
		}
		temp = et_chemistry.getText().toString();
		ht.setHete_chemistry(temp);
		if(rb_chemistry_defence_1.isChecked()==true){
			ht.setHete_chemistry_has_defence(1);
		}else if(rb_chemistry_defence_2.isChecked()==true){
			ht.setHete_chemistry_has_defence(2);
			temp = et_chemistry_defence.getText().toString();
			ht.setHete_chemistry_defence(temp);
		}
		temp = et_other_toxic.getText().toString();
		ht.setHete_other_toxic(temp);
		if(rb_other_toxic_defence_1.isChecked()==true){
			ht.setHete_other_toxic_has_defence(1);
		}else if(rb_other_toxic_defence_2.isChecked()==true){
			ht.setHete_other_toxic_has_defence(2);
			temp = et_other_toxic_defence.getText().toString();
			ht.setHete_other_toxic_defence(temp);
		}
		
		if(rb_lip_1.isChecked()==true){
			ht.setHete_lips(1);
		}else if(rb_lip_2.isChecked()==true){
			ht.setHete_lips(2);
		}else if(rb_lip_3.isChecked()==true){
			ht.setHete_lips(3);
		}else if(rb_lip_4.isChecked()==true){
			ht.setHete_lips(4);
		}else if(rb_lip_5.isChecked()==true){
			ht.setHete_lips(5);
		}
		
		if(rb_teeth_1.isChecked()==true){
			ht.setHete_teeth(1);
		}else if(rb_teeth_2.isChecked()==true){
			ht.setHete_teeth(2);
		}else if(rb_teeth_3.isChecked()==true){
			ht.setHete_teeth(3);
		}else if(rb_teeth_4.isChecked()==true){
			ht.setHete_teeth(4);
		}
		
		if(rb_throat_1.isChecked()==true){
			ht.setHete_throat(1);
		}else if(rb_throat_2.isChecked()==true){
			ht.setHete_throat(2);
		}else if(rb_throat_3.isChecked()==true){
			ht.setHete_throat(3);
		}
		
		temp = et_eyesight_left.getText().toString();
		if(temp.length()>0){
			ht.setHete_eyesight_left(Float.parseFloat(temp));
		}
		temp = et_eyesight_right.getText().toString();
		if(temp.length()>0){
			ht.setHete_eyesight_right(Float.parseFloat(temp));
		}
		temp = et_correct_eyesight_left.getText().toString();
		if(temp.length()>0){
			ht.setHete_correct_eyesight_left(Float.parseFloat(temp));
		}
		temp = et_correct_eyesight_right.getText().toString();
		if(temp.length()>0){
			ht.setHete_correct_eyesight_right(Float.parseFloat(temp));
		}
		
		if(rb_hearing_1.isChecked()==true){
			ht.setHete_hearing(1);
		}else if(rb_hearing_2.isChecked()==true){
			ht.setHete_hearing(2);
		}
		
		if(rb_motion_1.isChecked()==true){
			ht.setHete_motion_funtion(1);
		}else if(rb_motion_2.isChecked()==true){
			ht.setHete_motion_funtion(2);
		}
		
		if(rb_eyeground_1.isChecked()==true){
			ht.setHete_eyeground_isnormal(1);
		}else if(rb_eyeground_2.isChecked()==true){
			ht.setHete_eyeground_isnormal(2);
			temp = et_eyeground_abnormal.getText().toString();
			ht.setHete_eyeground_abnormal(temp);
		}
		
		if(rb_skin_1.isChecked()==true){
			ht.setHete_skin(1);
		}else if(rb_skin_2.isChecked()==true){
			ht.setHete_skin(2);
		}else if(rb_skin_3.isChecked()==true){
			ht.setHete_skin(3);
		}else if(rb_skin_4.isChecked()==true){
			ht.setHete_skin(4);
		}else if(rb_skin_5.isChecked()==true){
			ht.setHete_skin(5);
		}else if(rb_skin_6.isChecked()==true){
			ht.setHete_skin(6);
		}else if(rb_skin_7.isChecked()==true){
			ht.setHete_skin(7);
			temp = et_skin_other.getText().toString();
			ht.setHete_skin_other(temp);
		}
		
		if(rb_sclera_1.isChecked()==true){
			ht.setHete_sclera(1);
		}else if(rb_sclera_2.isChecked()==true){
			ht.setHete_sclera(2);
		}else if(rb_sclera_3.isChecked()==true){
			ht.setHete_sclera(3);
		}else if(rb_sclera_4.isChecked()==true){
			ht.setHete_sclera(4);
			temp = et_sclera_other.getText().toString();
			ht.setHete_sclera_other(temp);
		}
		
		if(rb_lymphnode_1.isChecked()==true){
			ht.setHete_lymphnode(1);
		}else if(rb_lymphnode_2.isChecked()==true){
			ht.setHete_lymphnode(2);
		}else if(rb_lymphnode_3.isChecked()==true){
			ht.setHete_lymphnode(3);
		}else if(rb_lymphnode_4.isChecked()==true){
			ht.setHete_lymphnode(4);
			temp = et_lymphnode_other.getText().toString();
			ht.setHete_lymphnode_other(temp);
		}
		
		if(rb_barrelchest_1.isChecked()==true){
			ht.setHete_barrelchest(1);
		}else if(rb_barrelchest_2.isChecked()==true){
			ht.setHete_barrelchest(2);
		}
		
		if(rb_breathsound_1.isChecked()==true){
			ht.setHete_breathsound_isnormal(1);
		}else if(rb_breathsound_2.isChecked()==true){
			ht.setHete_breathsound_isnormal(2);
			temp = et_breathsound_abnormal.getText().toString();
			ht.setHete_breathsound_abnormal(temp);
		}
		
		if(rb_rale_1.isChecked()==true){
			ht.setHete_rale(1);
		}else if(rb_rale_2.isChecked()==true){
			ht.setHete_rale(2);
		}else if(rb_rale_3.isChecked()==true){
			ht.setHete_rale(3);
		}else if(rb_rale_4.isChecked()==true){
			ht.setHete_rale(4);
			temp = et_rale_other.getText().toString();
			ht.setHete_rale_other(temp);
		}
		
		temp = et_heartrate.getText().toString();
		if(temp.length()>0){
			ht.setHete_heartrate(Integer.parseInt(temp));
		}
		
		if(rb_heart_rhythm_1.isChecked()==true){
			ht.setHete_heart_rhythm(1);
		}else if(rb_heart_rhythm_2.isChecked()==true){
			ht.setHete_heart_rhythm(2);
		}else if(rb_heart_rhythm_3.isChecked()==true){
			ht.setHete_heart_rhythm(3);
		}
		
		if(rb_heart_murmurs_1.isChecked()==true){
			ht.setHete_has_heart_murmurs(1);
		}else if(rb_heart_murmurs_2.isChecked()==true){
			ht.setHete_has_heart_murmurs(2);
			temp = et_heart_murmurs.getText().toString();
			ht.setHete_heart_murmurs(temp);
		}
		
		ht.updateHealthTest(this.profileid,this.testid);
	}


	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v==rb_skin_1){
			rb_skin_1.setChecked(true);
			rb_skin_2.setChecked(false);
			rb_skin_3.setChecked(false);
			rb_skin_4.setChecked(false);
			rb_skin_5.setChecked(false);
			rb_skin_6.setChecked(false);
			rb_skin_7.setChecked(false);
		}
		else if(v==rb_skin_2){
			rb_skin_1.setChecked(false);
			rb_skin_2.setChecked(true);
			rb_skin_3.setChecked(false);
			rb_skin_4.setChecked(false);
			rb_skin_5.setChecked(false);
			rb_skin_6.setChecked(false);
			rb_skin_7.setChecked(false);
		}
		else if(v==rb_skin_3){
			rb_skin_1.setChecked(false);
			rb_skin_2.setChecked(false);
			rb_skin_3.setChecked(true);
			rb_skin_4.setChecked(false);
			rb_skin_5.setChecked(false);
			rb_skin_6.setChecked(false);
			rb_skin_7.setChecked(false);
		}
		else if(v==rb_skin_4){
			rb_skin_1.setChecked(false);
			rb_skin_2.setChecked(false);
			rb_skin_3.setChecked(false);
			rb_skin_4.setChecked(true);
			rb_skin_5.setChecked(false);
			rb_skin_6.setChecked(false);
			rb_skin_7.setChecked(false);
		}
		else if(v==rb_skin_5){
			rb_skin_1.setChecked(false);
			rb_skin_2.setChecked(false);
			rb_skin_3.setChecked(false);
			rb_skin_4.setChecked(false);
			rb_skin_5.setChecked(true);
			rb_skin_6.setChecked(false);
			rb_skin_7.setChecked(false);
		}
		else if(v==rb_skin_6){
			rb_skin_1.setChecked(false);
			rb_skin_2.setChecked(false);
			rb_skin_3.setChecked(false);
			rb_skin_4.setChecked(false);
			rb_skin_5.setChecked(false);
			rb_skin_6.setChecked(true);
			rb_skin_7.setChecked(false);
		}
		else if(v==rb_skin_7){
			rb_skin_1.setChecked(false);
			rb_skin_2.setChecked(false);
			rb_skin_3.setChecked(false);
			rb_skin_4.setChecked(false);
			rb_skin_5.setChecked(false);
			rb_skin_6.setChecked(false);
			rb_skin_7.setChecked(true);
		}
		else if(v==et_abstinent_age){
			rb_abstinent_1.setChecked(false);
			rb_abstinent_2.setChecked(true);
		}
		else if(v==et_drink_sort_other){
			cb_drink_sort_5.setChecked(true);
		}
		else if(v==et_dust_defence){
			rb_dust_defence_1.setChecked(false);
			rb_dust_defence_2.setChecked(true);
		}
		else if(v==et_radiation_defence){
			rb_radiation_defence_1.setChecked(false);
			rb_radiation_defence_2.setChecked(true);
		}
		else if(v==et_physics_defence){
			rb_physics_defence_1.setChecked(false);
			rb_physics_defence_2.setChecked(true);
		}
		else if(v==et_chemistry_defence){
			rb_chemistry_defence_1.setChecked(false);
			rb_chemistry_defence_2.setChecked(true);
		}
		else if(v==et_other_toxic_defence){
			rb_other_toxic_defence_1.setChecked(false);
			rb_other_toxic_defence_2.setChecked(true);
		}
		else if(v==et_eyeground_abnormal){
			rb_eyeground_1.setChecked(false);
			rb_eyeground_2.setChecked(true);
		}
		else if(v==et_skin_other){
			rb_skin_1.setChecked(false);
			rb_skin_2.setChecked(false);
			rb_skin_3.setChecked(false);
			rb_skin_4.setChecked(false);
			rb_skin_5.setChecked(false);
			rb_skin_6.setChecked(false);
			rb_skin_7.setChecked(true);
		}
		else if(v==et_sclera_other){
			rb_sclera_1.setChecked(false);
			rb_sclera_2.setChecked(false);
			rb_sclera_3.setChecked(false);
			rb_sclera_4.setChecked(true);
		}
		else if(v==et_lymphnode_other){
			rb_lymphnode_1.setChecked(false);
			rb_lymphnode_2.setChecked(false);
			rb_lymphnode_3.setChecked(false);
			rb_lymphnode_4.setChecked(true);
		}
		else if(v==et_breathsound_abnormal){
			rb_breathsound_1.setChecked(false);
			rb_breathsound_2.setChecked(true);
		}
		else if(v==et_rale_other){
			rb_rale_1.setChecked(false);
			rb_rale_2.setChecked(false);
			rb_rale_3.setChecked(false);
			rb_rale_4.setChecked(true);
		}
		else if(v==et_heart_murmurs){
			rb_heart_murmurs_1.setChecked(false);
			rb_heart_murmurs_2.setChecked(true);
		}
		
	}


	@Override
	public void onFocusChange(View v, boolean hasFocus) {
		// TODO Auto-generated method stub
		if(hasFocus){
			if(v==et_abstinent_age){
				rb_abstinent_1.setChecked(false);
				rb_abstinent_2.setChecked(true);
			}
			else if(v==et_drink_sort_other){
				cb_drink_sort_5.setChecked(true);
			}
			else if(v==et_dust_defence){
				rb_dust_defence_1.setChecked(false);
				rb_dust_defence_2.setChecked(true);
			}
			else if(v==et_radiation_defence){
				rb_radiation_defence_1.setChecked(false);
				rb_radiation_defence_2.setChecked(true);
			}
			else if(v==et_physics_defence){
				rb_physics_defence_1.setChecked(false);
				rb_physics_defence_2.setChecked(true);
			}
			else if(v==et_chemistry_defence){
				rb_chemistry_defence_1.setChecked(false);
				rb_chemistry_defence_2.setChecked(true);
			}
			else if(v==et_other_toxic_defence){
				rb_other_toxic_defence_1.setChecked(false);
				rb_other_toxic_defence_2.setChecked(true);
			}
			else if(v==et_eyeground_abnormal){
				rb_eyeground_1.setChecked(false);
				rb_eyeground_2.setChecked(true);
			}
			else if(v==et_skin_other){
				rb_skin_1.setChecked(false);
				rb_skin_2.setChecked(false);
				rb_skin_3.setChecked(false);
				rb_skin_4.setChecked(false);
				rb_skin_5.setChecked(false);
				rb_skin_6.setChecked(false);
				rb_skin_7.setChecked(true);
			}
			else if(v==et_sclera_other){
				rb_sclera_1.setChecked(false);
				rb_sclera_2.setChecked(false);
				rb_sclera_3.setChecked(false);
				rb_sclera_4.setChecked(true);
			}
			else if(v==et_lymphnode_other){
				rb_lymphnode_1.setChecked(false);
				rb_lymphnode_2.setChecked(false);
				rb_lymphnode_3.setChecked(false);
				rb_lymphnode_4.setChecked(true);
			}
			else if(v==et_breathsound_abnormal){
				rb_breathsound_1.setChecked(false);
				rb_breathsound_2.setChecked(true);
			}
			else if(v==et_rale_other){
				rb_rale_1.setChecked(false);
				rb_rale_2.setChecked(false);
				rb_rale_3.setChecked(false);
				rb_rale_4.setChecked(true);
			}
			else if(v==et_heart_murmurs){
				rb_heart_murmurs_1.setChecked(false);
				rb_heart_murmurs_2.setChecked(true);
			}
		}
	}

}
